home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Dialing Addresses / Src / AudioLib.h < prev   
Encoding:
C/C++ Source or Header  |  2000-06-23  |  5.4 KB  |  148 lines

  1. /****************************************************************************
  2.  *
  3.  *      Copyright (c) 1999, TRG, All Rights Reserved
  4.  *
  5.  *---------------------------------------------------------------------------
  6.  * FileName:
  7.  *              AudioLib.h
  8.  *
  9.  * Description:
  10.  *              Audio library API definitions.
  11.  *
  12.  *
  13.  ****************************************************************************/
  14.  
  15.  
  16. #ifndef __AUDIO_LIB_H__
  17. #define __AUDIO_LIB_H__
  18.  
  19.  
  20. /*---------------------------------------------------------------------------
  21.  * If we're actually compiling the library code, then we need to
  22.  * eliminate the trap glue that would otherwise be generated from
  23.  * this header file in order to prevent compiler errors in CW Pro 2.
  24.  *--------------------------------------------------------------------------*/
  25. #ifdef BUILDING_AUDIO_LIB
  26.         #define AUDIO_LIB_TRAP(trapNum)
  27. #else
  28.         #define AUDIO_LIB_TRAP(trapNum) SYS_TRAP(trapNum)
  29. #endif
  30.  
  31.  
  32. /****************************************************************************
  33.  * Type and creator of Sample Library database -- must match project defs!
  34.  ****************************************************************************/
  35. #define AudioLibCreatorID  'trgA'       // Audio Library database creator
  36. #define AudioLibTypeID     'libr'       // Standard library database type
  37.  
  38.  
  39. /***************************************************************************
  40.  * Internal library name which can be passed to SysLibFind()
  41.  ***************************************************************************/
  42. #define AudioLibName       "Audio.lib"     
  43.  
  44.  
  45. /***************************************************************************
  46.  * Defines for Audio library calls
  47.  ***************************************************************************/
  48.  
  49. /*--------------------------------------------------------------------------
  50.  * Audio Library result codes
  51.  * (appErrorClass is reserved for 3rd party apps/libraries.
  52.  * It is defined in SystemMgr.h)
  53.  *
  54.  * These are for errors specific to loading/opening/closing the library
  55.  *-------------------------------------------------------------------------*/
  56. #define AudioErrorClass              (appErrorClass | 0x400)
  57.  
  58. #define AUDIO_ERR_BAD_PARAM          (AudioErrorClass | 1)    // invalid parameter
  59. #define AUDIO_ERR_LIB_NOT_OPEN       (AudioErrorClass | 2)    // library is not open
  60. #define AUDIO_ERR_LIB_IN_USE         (AudioErrorClass | 3)    // library still in used
  61.  
  62. typedef enum {
  63.     AudioLibTrapGetLibAPIVersion = sysLibTrapCustom,
  64.     AudioLibTrapGetMasterVolume,
  65.     AudioLibTrapSetMasterVolume,
  66.     AudioLibTrapGetMute,
  67.     AudioLibTrapSetMute,
  68.     AudioLibTrapPlayDTMFChar,
  69.     AudioLibTrapPlayDTMFStr,
  70.     AudioLibTrapLast
  71. } AudioLibTrapNumberEnum;
  72.  
  73.  
  74. /********************************************************************
  75.  *              
  76.  ********************************************************************/
  77.  
  78. typedef enum {AUDIO_MUTE_OFF, AUDIO_MUTE_ON} mute_type;
  79.  
  80. #define AUDIO_VOLUME_MAX      63
  81. #define AUDIO_VOLUME_MIN      0
  82.  
  83. #ifdef __cplusplus
  84. extern "C" {
  85. #endif
  86.  
  87.  
  88. /*--------------------------------------------------------------------------
  89.  * Standard library open, close, sleep and wake functions
  90.  *-------------------------------------------------------------------------*/
  91.  
  92. /* open the library */
  93. extern Err AudioLibOpen(UInt16 libRef)
  94.                                 AUDIO_LIB_TRAP(sysLibTrapOpen);
  95.                 
  96. /* close the library */
  97. extern Err AudioLibClose(UInt16 libRef)
  98.                                 AUDIO_LIB_TRAP(sysLibTrapClose);
  99.  
  100. /* library sleep */
  101. extern Err AudioLibSleep(UInt16 libRef)
  102.                                 AUDIO_LIB_TRAP(sysLibTrapSleep);
  103.  
  104. /* library wakeup */
  105. extern Err AudioLibWake(UInt16 libRef)
  106.                                 AUDIO_LIB_TRAP(sysLibTrapWake);
  107.  
  108. /*--------------------------------------------------------------------------
  109.  * Custom library API functions
  110.  *--------------------------------------------------------------------------*/
  111.  
  112. /* Get our library API version */
  113. extern Err AudioGetLibAPIVersion(UInt16 libRef, UInt32 *dwVerP)
  114.                                  AUDIO_LIB_TRAP(AudioLibTrapGetLibAPIVersion);
  115.     
  116. extern Err AudioGetMasterVolume(UInt16 libRef, UInt8 *volume)
  117.                                  AUDIO_LIB_TRAP(AudioLibTrapGetMasterVolume);
  118.     
  119. extern Err AudioSetMasterVolume(UInt16 libRef, UInt8 volume)
  120.                                  AUDIO_LIB_TRAP(AudioLibTrapSetMasterVolume);
  121.  
  122. extern Err AudioGetMute(UInt16 libRef, mute_type *mute)
  123.                                  AUDIO_LIB_TRAP(AudioLibTrapGetMute);
  124.  
  125. extern Err AudioSetMute(UInt16 libRef,mute_type mute)
  126.                                  AUDIO_LIB_TRAP(AudioLibTrapSetMute);
  127.  
  128.     
  129. extern void AudioPlayDTMFChar(UInt16 libRef,char ascChar, Int16 toneLength)
  130.                                  AUDIO_LIB_TRAP(AudioLibTrapPlayDTMFChar);
  131.  
  132. extern void AudioPlayDTMFStr(UInt16 libRef,char *ascStr, Int16 toneLength, Int16 toneGap)
  133.                                  AUDIO_LIB_TRAP(AudioLibTrapPlayDTMFStr);
  134.  
  135. /*---------------------------------------------------------------------------
  136.  * For loading the library in PalmPilot Mac emulation mode
  137.  *--------------------------------------------------------------------------*/
  138.  
  139. extern Err AudioLibInstall(UInt16 libRef, SysLibTblEntryPtr entryP);
  140.  
  141.  
  142. #ifdef __cplusplus 
  143. }
  144. #endif
  145.  
  146.  
  147. #endif  // __AUDIO_LIB_H__
  148.